BEGIN {
cols=3;
if (mode=="pre_bylib")
{
}
else if (mode=="post_bylib")
{
print "
"
first=1;
dl=1;
}
if (mode=="pre_byname")
{
}
else if (mode=="post_byname")
{
first=1;
print ""
dl=1;
table=0;
}
}
{
if (mode=="pre_bylib")
{
file=$1;
gsub("..\/html\/","",file);
first=toupper(substr($2,1,1));
libs[$3]=libs[$3] first;
print $3":"first":"$2":"file;
}
else if (mode=="post_bylib")
{
if ($1=="-")
{
if (first)
{
print "- A.2 Reference by library
"
dl++;
first=0;
cnt=1;
}
print ""
if ($2=="Utility functions")
print ""
else
print ""
print "A.2."cnt" "$2" ("
cnt ++;
libini[$2]=$3;
initials=$3;
for (t=1; t<=length(initials); t++)
{
c=substr(initials,t,1);
print ""c" "
}
print ")
"
lib="";
char="";
}
else
{
if (lib != $1)
{
if (table)
{
while (horiz && horiz < cols)
{
print " | "
horiz++;
}
print ""
table=0;
}
if (lib != "")
{
print "
"
dl--;
}
else
{
print "
"
cnt=1;
}
lib = $1;
print "
- "
if (lib=="Utility functions")
print ""
else
print ""
print "A.2."cnt " " $1"
- "
cnt ++;
initials=libini[lib];
for (t=1; t<=length(initials); t++)
{
c=substr(initials,t,1);
print ""c" "
}
print "
"
dl++;
}
if (char != $2)
{
char=$2;
if (table)
{
while (horiz && horiz < cols)
{
print " | "
horiz++;
}
print ""
table=0;
}
print "- "
print ""
print ""char"
- "
print "
"
table=1;
horiz=0;
}
if (horiz==0)
{
print ""
}
print ""
print ""$3"() "
print " | "
horiz++;
if (horiz==cols)
{
print "
"
horiz=0;
}
}
}
if (mode=="pre_byname")
{
first=substr($2,1,1);
initials=initials first;
file=$1;
gsub("..\/html\/","",file);
print toupper(first)":"$2":"file;
}
else if (mode=="post_byname")
{
if ($1=="-")
{
print "- A.3 Reference by name
- "
for (t=1; t<=length($2); t++)
{
char=substr($2,t,1);
print ""char" "
}
print "
"
dl++;
char="-";
}
else
{
if (char!=$1)
{
if (table)
{
while (horiz && horiz < cols)
{
print " | "
horiz++;
}
print "
"
table=0;
}
if (char != "-")
{
print "
"
dl--;
}
else
print "
"
char = $1;
print "
- "char"
- "
print "
"
dl++;
print ""
table=1;
horiz=0;
}
if (horiz==0)
{
print ""
}
print ""
print "" $2 "()"
print " | "
horiz++;
if (horiz==cols)
{
print "
"
horiz=0;
}
}
}
}
END {
if (mode=="pre_bylib")
{
alphabeth="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
for (lib in libs)
{
out="";
for (t=1; t<=26; t++)
{
if (index(libs[lib],substr(alphabeth,t,1)))
out=out substr(alphabeth,t,1);
}
print "-:"lib":"out;
}
}
else if (mode=="post_bylib")
{
if (table)
{
while (horiz && horiz < cols)
{
print " | "
horiz++;
}
print "
"
}
while (dl--)
print "
"
}
if (mode=="pre_byname")
{
alphabeth="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
out="";
for (t=1; t<=26; t++)
{
if (index(initials,substr(alphabeth,t,1)))
out=out substr(alphabeth,t,1);
}
print "-:" out;
}
else if (mode=="post_byname")
{
if (table)
{
while (horiz && horiz < cols)
{
print " | "
horiz++;
}
print ""
}
while (dl--)
print "
"
}
}